package com.xiaoxu.intranetweb.mybatisplusSzappdb.controller.product;

import cn.dev33.satoken.stp.StpUtil;
import com.xiaoxu.intranetweb.mybatisplusSzappdb.business.product.PdtAdvancedBu;
import com.xiaoxu.intranetweb.mybatisplusSzappdb.dao.UserInfoDao;
import com.xiaoxu.intranetweb.util.PermissionCheck;
import com.xiaoxu.intranetweb.util.SzResult;
import com.xiaoxu.intranetweb.util.WebFunctionUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RestController
@RequestMapping("/pdtAdvanced")
public class PdtAdvancedController {
    @Autowired
    private PdtAdvancedBu pdtAdvancedBu;
    @Autowired
    private UserInfoDao userInfoDao;

    @Autowired
    private WebFunctionUtil webFunctionUtil;
    //品种的高级操作
    //String id, String gateHeadStatus, String loadControlStatus, String identifyLoadStatus, String planControllerStatus,
    //                                         String queueControllerStatus, String identifyQueueStatus, String inOutStatus, String token
    @GetMapping("/pdtAdvanced")
    @PermissionCheck("pdtAdvanced_pdtAdvanced")
    public SzResult pdtAdvanced(@RequestParam String id,
                                @RequestParam (value = "loadStatus", required = false) String loadStatus,
                                @RequestParam (value = "loadControlStatus", required = false) String loadControlStatus,
                                @RequestParam (value = "identifyLoadStatus", required = false) String identifyLoadStatus,
                                @RequestParam (value = "planControllerStatus", required = false) String planControllerStatus,
                                @RequestParam (value = "queueControllerStatus", required = false) String queueControllerStatus,
                                @RequestParam (value = "identifyQueueStatus", required = false) String identifyQueueStatus,
                                @RequestParam (value = "inOutStatus", required = false) String inOutStatus,
                                @RequestParam (value = "pdtClassFromCtrlStatus", required = false) String pdtClassFromCtrlStatus,
                                HttpServletRequest request) throws Exception {
        String token = request.getHeader("Authorization");
        String plantId = request.getHeader("Plant-Id");
        return pdtAdvancedBu.pdtAdvanced(id, loadStatus, loadControlStatus, identifyLoadStatus,planControllerStatus,queueControllerStatus,identifyQueueStatus,inOutStatus,pdtClassFromCtrlStatus,token,plantId);
    }

}
